from pages.login_page import LoginPage
from time import sleep
from selenium import webdriver
from selenium.webdriver.common.by import By
all_locater = (By.XPATH, '//*[@id="root"]/div/div/div[2]/div[2]/main/div/div[2]/div/div/div/div[2]/div'
                         '/div[1]/div/div[2]/div[1]/label')


def login():
    """获取cookie"""
    driver = webdriver.Chrome()
    driver.maximize_window()
    xxx = LoginPage(driver)
    xxx.goat_erp_login('17313699441', '17313699441')
    sleep(3)
    cookie = driver.get_cookies()
    return cookie






# driver = webdriver.Chrome()
# driver.maximize_window()
# driver.get('http://192.168.1.139')
# driver.add_cookie({'name': 'PHPSESSID', 'value': 'keuqk8ksb3gu51bk08mt3css17'})
# driver.get('http://192.168.1.139/crm/index.php?m=contract')
# sleep(2)